import { getTimeText } from './tools';

const fishTitle: string = 'fish';

function print(list: any[], color: string) {
  console.log.apply(console, [`[${fishTitle}: ${getTimeText()}] %c ${list.shift()}`, `color:${color}`, ...list]);
}

const log = {
  text(text: string, num: number) {
    console.log(fishTitle + text, num);
  },
  info(...args: any[]) {
    if (args.length) print(args, 'green');
  },
  warn(...args: any[]) {
    if (args.length) print(args, '#ccbf27');
  },
  err(...args: any[]) {
    if (args.length) print(args, 'red');
  },
};

export default log;
